<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>title</title>
    <script>
        function myFunc() {
            document.getElementById("output").innerHTML = "Hello World";
        }
    </script>
    <script type="text/javascript" src="07.js"></script>
</head>

<body>
    <h2>script 标签</h2>
    <script>
        document.write("Hello World");
    </script>


    <h2>JavaScript 在Head中</h2>
    <button type="button" onclick="myFunc()">111</button>
    <p id="output">这是一个段落</p>

    <h2>JavaScript 放在Body中</h2>
    <button type="button" onclick="myFunc1()">111</button>
    <p id="111">这是一个段落</p>
    <script>
        function myFunc1() {
            document.getElementById("111").innerHTML = "222";
        }
    </script>

    <h2 id="demo">内联放置JavaScript代码</h2>
    <p onclick="document.getElementById('demo').style.display='none'">单击我隐藏上方标题</p>
    <p onclick="this.innerHTML='Hello World';">这是第一段(点我)</p>
    <p onmouseover="this.style.fontSize='2em';">这是第二段(鼠标放在我身上)</p>
</body>

</html>